package device;

public class Device {
	private int machineTime;
	private int pid;//-1代表未占用
	private char type;
	
	public Device(char type) {
		this.machineTime=-1;
		this.pid=-1;
		this.type=type;
	}
	
	public void occupyDevice(int machineTime,int pid) {//得到设备并占用
		this.machineTime=machineTime;
		this.pid=pid;
		
	}
	
	public void releaseDevice() {
		this.machineTime=-1;
		this.pid=-1;
	}
	
	public void reduceMachineTime() {//设备时间递减
		if(machineTime>0) {
				this.machineTime--;
		}

	}
	
	public int getMachineTime() {
		return this.machineTime;
	}
	
	public int getPid() {
		return this.pid;
	}

	public void setMachineTime(int machineTime) {
		this.machineTime = machineTime;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public char getType() {
		return type;
	}
}
